SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE [dbo].[usp_UpdateStudentInfo]
      (
        @fdStudNo VARCHAR(50) ,
        @fdStudPwd VARCHAR(50) ,
        @fdStudName VARCHAR(50) ,
        @fdStudSchool VARCHAR(50) ,
        @fdStudCollege VARCHAR(50) ,
        @fdStudSpec VARCHAR(50) ,
        @fdLongevity VARCHAR(50) ,
        @fdStudMethod VARCHAR(50) ,
        @fdSex VARCHAR(50) ,
        @fdTrain VARCHAR(50) ,
        @fdStudYearInt VARCHAR(50) ,
        @fdStudYearOut VARCHAR(50) ,
        @fdStudIDCard VARCHAR(20) ,
        @fdNation VARCHAR(50) ,
        @fdPolitics VARCHAR(50) ,
        @fdPlace VARCHAR(50) ,
        @fdStudTrainUnit VARCHAR(50) ,
        @fdStudPhone VARCHAR(50) ,
        @fdStudHomeTel VARCHAR(50)
      )
AS 
      DECLARE @Pwd VARCHAR(50)
      SET @Pwd = (
                   SELECT   fdStudPwd
                   FROM     dbo.FS_Student
                   WHERE    fdStudNo = @fdStudNo
                 )
      UPDATE    dbo.FS_Student
      SET       fdStudPwd = CASE @fdStudPwd
                              WHEN '' THEN @Pwd
                              ELSE @fdStudPwd
                            END ,
                fdStudName = @fdStudName ,
                fdStudSchool = @fdStudSchool ,
                fdStudCollege = @fdStudCollege ,
                fdStudSpec = @fdStudSpec ,
                fdLongevity = @fdLongevity ,
                fdStudMethod = @fdStudMethod ,
                fdSex = @fdSex ,
                fdTrain = @fdTrain ,
                fdStudYearInt = @fdStudYearInt ,
                fdStudYearOut = @fdStudYearOut ,
                fdStudIDCard = @fdStudIDCard ,
                fdNation = @fdNation ,
                fdPolitics = @fdPolitics ,
                fdPlace = @fdPlace ,
                fdStudTrainUnit = fdStudTrainUnit ,
                fdStudPhone = @fdStudPhone ,
                fdStudHomeTel = @fdStudHomeTel
      WHERE     fdStudNo = @fdStudNo


GO
